using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace Cephei
{
    public enum CellMethod
    {
        Unknown,                    // initial value.. before calculator or value assigned
        OnDemand,                   // calculate whenever needed
        InThread,                   // calculate in the threadpool
        OnDemandOrInLine,           // last calculation was quicker than scheduling, so decide onDemand or InLine next time
        InLine,                     // calculate whenever a dependancy changes
        InGrid,                     // calculate by dispatch to a grid !! not implemented
        ByAssignment                // not calculated, but assigned
    };

    public enum CellEventType
    {
        Create = 0,					// default is that it was simply created
        CircularReferenceCheck,		// Check for Circular references
        Invalidate,					// Invaidate message is sent by threaded calcualtions to invalidate objects without causing a cascade of blocked threads
        Calculate,					// do the calculation if needed 
        ErrorAbort,					// an error occured in the calcualtion.. all dependant changes should be abandoned
        Change,						// notify parent object that this value has changed
        SimulationComplete,         // Sent by a scenario cells to signal other scenario or Outcome objects that it has completed
        SimulationReset,            // Sent by a Scenario Outcome object to reset Scenarios
        Link                        // when the value of a cell changes in the model, force ICalculators to switch references
    };

    public enum CellState
    {
        IsUnknown = 0,				// To allow for forward declaration, to be determined later
        IsValue = 1,                // is a value
        IsClean = 2,                // is calculated and has a clean value
        IsDirty = 4,                // is calculated, but the value is invalid
        IsCollection = 8,           // is a value collection
        IsError = 16,               // is normally calculated, but the last caculation produced an error
    };
}
